<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>修改员工页面</h1>
<div>
<input type="text" v-model="emp.id" readonly>
<input type="text" v-model="emp.name">
<input type="text" v-model="emp.sal">
<input type="text" v-model="emp.job">
<input type="button" value="修改" @click="update()">
</div>
<!--引入Vue框架-->
<script src="https://unpkg.com/vue@2.6.14/dist/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
  let v=new Vue({
           el:"body>div",
           data:{
             emp:{id:0,name:"",sal:0,job:""}

           },
           methods:{
             update(){
               axios.post("/update",v.emp).then(function (response){
                 location.href="/select.html"
               })
             }

           },
           created:function (){
             //得到地址栏中的id  location,search得到地址栏中的参数
             let id =location.search.split("=")[1];
             console.log("id="+id)
             //发送请求获取员工信息
             axios.get("/selectById?id="+id).then(function (response){
               v.emp=response.data;
             })
           }
       })
</script>
</body>
</html>